Repository navigation
GEP-26: translate GINQ window functions to SQL OVER - #3167
daniellansun wants to merge 2 commits into
Conversation
a820bef to
e5c99c7
Compare
|
Looked at this for alpha-1 too. The code is confined to Before merging:
|
b17eca5 to
e43897f
Compare
e43897f to
84f51c8
Compare
|
Thanks Paul. The user guide no longer lists window functions as a strict-mode restriction. Portable GINQ window functions now translate in strict mode under This branch is rebased onto the current #3155 tip. I'll rebase again once #3155 lands. The earlier Windows failure was the post-build cache scrub, as you noted, not a test failure. GEP-26's coverage and deferred tables on the website still list window functions as deferred. I'll update those next. |
a4ce5f3 to
b5435d7
Compare
…che#2658) Co-authored-by: Daniel Sun <sunlan@apache.org>
b5435d7 to
848656d
Compare
✅ All tests passed ✅🏷️ Commit: 848656d Learn more about TestLens at testlens.app/docs. |
Summary
Full GINQ → SQL window-function support for GEP-26 (not IR-only), plus corrections so window frames, ranks, and SQL
OVERfollow one set of rules on the collection provider and on the SQL providers.Depends on: #3155. Branch is maintained by rebase only (never merge) onto current
gep26-sql/ #3155 tip. Future #3155 changes are rebased onto this branch the same way.Related: GEP-26.
What this does
Kind.WINDOW(before seal):rowNumber,rank,denseRank,percentRank,cumeDist,ntile,lead,lag,firstValue,lastValue,nthValue, plus windowcount/sum/avg/min/max.fn(...) over(partitionby ... orderby ... rows|range ...)through existingSqlWindow*IR; native + jOOQ renderers emit ANSIOVER.rowNumber/nthValue,ntileformula, single-rowpercentRank=1,sumnull→0, whole partition when no frame.Window frame / rank / OVER corrections
rank,denseRank,percentRankandcumeDistuse everyorderbykey.leadandlagmove within the ordered partition.rowNumberandntiledo too, so a frame does not change them. SQL still rejects a frame on those functions, and onrankand its relatives, because SQL defines them without one. In memory,rankand its relatives still honor a frame.avg, and a variance or standard deviation with no samples, is null.rangeoffset is a value interval in either sort direction. A descendingorderbyrewrites the SQLRANGEbounds so the interval stays the same.rowsbounds are not rewritten.ntileis GINQ's 0-based formula, rendered with integer division (CASTtoBIGINT, orINTEGERon SQLite) instead ofFLOOR.RANGEoffset is rejected at render time on SQLite, and on MySQL and MariaDB, where null ordering is a second sort key.COUNT(DISTINCT) OVERis rejected on SQLite. Both checks are shared by the native renderer and the jOOQ renderer.Tests
./gradlew :groovy-ginq:test :groovy-ginq-sql:test677 tests in
groovy-ginq, 216 tests ingroovy-ginq-sql.Still deferred / limits
GROUPS,EXCLUDE,FILTER, a namedWINDOWclause, and the window forms ofmedian,stdev,stdevp,var,varpandaggstay deferred.rowNumber,ntile,leadandlagwithoutorderbyfollow scan order in SQL and insertion order in memory.RANGEoffset is printed by the native renderer. jOOQ accepts only an integer literal offset.rankwith a frame stays frame-sensitive in memory and is rejected in SQL.rangewith a finite bound is an error. A date or timerangeis not supported.mixedModedoes not move those clauses back into memory.Tip / CM
gep26-sql-windowb17eca58d5b094cb1a304d2a6294ed11993dffc9(Author/Committer: Daniel Sun<sunlan@apache.org>)gep26-sql@e8244ce944bbAuto-merge paused; do not merge until Daniel notifies resume + review.